<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags"%>
<script type="text/javascript">
	$(function() {
		var $grid = $('#grid_certificate');
		var $title = '证书';
		var $baseUrl = 'hrm/certificate';
		$grid.datagrid({
			title : $title + '列表',
			url : $baseUrl + '/page?sort=user.id,asc&sort=sort,asc',
			dialog : {
				url : $baseUrl,
				name : $title,
				create : {
					width : 660,
					height : 400
				},
				update : {
					width : 660,
					height : 400
				}
			},
			pagination : true,
			pageSize : 50,
			pageList : [ 50, 100, 200 ],
			columns : [ [ {
				field : 'name',
				width : 120,
				title : '证书名称',
				formatter : function(value, row, index) {
					return row.type ? row.type.name : '';
				}
			}, {
				field : 'user',
				width : 80,
				title : '员工',
				formatter : function(value, row, index) {
					return row.user ? row.user.name : '';
				}
			}, {
				field : 'no',
				width : 120,
				title : '证书编号'
			}, {
				field : 'download',
				width : 40,
				title : '扫描件',
				formatter : function(value, row, index) {
					return '<a class="file_link" href="hrm/certificate/download?id=' + row.id + '">下载</a>';
				}
			},{
				field : 'regNo',
				width : 120,
				title : '注册编号'
			}, {
				field : 'issueDate',
				width : 120,
				title : '发证日期'
			}, {
				field : 'expiryDate',
				width : 120,
				title : '到期日期'
			}, {
				field : 'cycle',
				width : 120,
				title : '年审周期'
			}, {
				field : 'continueEdu',
				width : 120,
				title : '继教',
				formatter : function(value, row, index) {
					return row.continueEdu ? '是' : '否';
				}
			}, {
				field : 'need',
				width : 120,
				title : '公司需要',
				formatter : function(value, row, index) {
					return row.need ? '是' : '否';
				}
			}, $.fields.description, $.fields.sort ] ],
			toolbar : [ <sec:authorize access="hasRole('HRM_CER_ADD')"> $.crudgrid.buttons.create,</sec:authorize><sec:authorize access="hasRole('HRM_CER_EDIT')"> $.crudgrid.buttons.update, </sec:authorize><sec:authorize access="hasRole('HRM_CER_DELETE')">$.crudgrid.buttons.remove,</sec:authorize> '-', $.crudgrid.buttons.refresh ]
		}).treegrid('filter.init');
	});
</script>
<div class="easyui-layout" data-options="fit:true">
	<div data-options="region:'center',split:true,border:false">
		<table id="grid_certificate"></table>
	</div>
</div>